<template>
    <el-row type="flex" justify="center" class="tac" style="margin-top:50px;margin-bottom: 300px">


    <el-col :span="22">

        <el-table
        :data="stuList"
        border
        stripe
        style="width: 100%">
        <el-table-column
        prop="username"
        label="学生姓名"
        width="180">
        </el-table-column>
        <el-table-column
        prop="phone"
        label="手机号"
        width="180">
        </el-table-column>
        <el-table-column
        prop="created"
        label="加入时间">
        </el-table-column>

         <el-table-column label="操作">
            <template slot-scope="scope">
                <el-button
                size="mini"
                @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                <el-button
                size="mini"
                type="danger"
                @click="handleDelete(scope.$index, scope.row)">删除</el-button>
            </template>
        </el-table-column>
    </el-table>

    </el-col>

    </el-row>


</template>

<script>
import classesApi from '@/api/classes'
import { config } from '@vue/test-utils';
export default {
    data(){
        return{
            stuList:[]
        }
    },

    created(){
        this.cid = this.$route.query.cid
        //this.fetchStuList()

        if(this.cid != null){
            this.fetchStuList()
        }
    },

    methods: {
        fetchStuList(){
            classesApi.queryStuListByCid(this.cid).then(response =>{
                if(response.flag){
                    this.stuList = response.data
                    console.log(this.stuList)
                }
            })
        }
    }
}
</script>
